import 'whatwg-fetch';

export const get = (url, params) => {
    let newUlr = url;
    let count = 0;
    if (params) {
        newUlr += '?';
        for (key in params) {
            let value = params[key];
            if (typeof value === 'object') {
                value = JSON.stringify(value);
            }
            count++;
            newUlr += ((count > 1 ? '&' : '') + key + '=' + value);
        }
    }
    return fetch(newUlr);
}